package com.iwomy.envpro.platform.constant;

import cn.hutool.core.lang.Console;
import com.google.common.base.CaseFormat;

public enum CpEnum {
	SO2("SO2", "二氧化硫","a21026"),
	CO("CO", "一氧化碳","a21005"),
	NO2("NO2", "二氧化氮","a21004"),
	O3("O3", "臭氧","a80218"),
	T_VOC("T-VOC", "T_VOC","aa0002"),
	PM2_5("PM2.5", "PM2_5","a34004"),
	PM10("PM10", "PM10","a34002"),
	PM1_0("pm1.0", "PM1_0","a34005"),
	TSP("TSP", "TSP","a34001"),
	TEMPERATURE("TEMPERATURE", "温度","a01001"),
	HUMIDITY("HUMIDITY", "湿度","a01002"),
	WIND_SPEED("WIND_SPEED", "风速","a01007"),
	WIND_DIRECTION("WIND_DIRECTION", "风向","a01008"),
	NOISE("NOISE", "噪声","aa0003"),
	PRESSURE("PRESSURE", "气压","a01006"),
	CO2("CO2", "二氧化碳","a05001"),
	BATTERY_LEVEL("BATTERY_LEVEL", "电池电量","aa0004"),
	ILLUMINATION("ILLUMINATION", "光照","a54321"),
	;

	private String code;
	private String name;
	private String reportCode;

	public static void main(String[] args) {
		String to = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, CpEnum.BATTERY_LEVEL.toString());
		Console.log(to);

	}
	public static String getVarByReportCode(String code){
		for (CpEnum cpEnum : values()) {
			if (cpEnum.getReportCode().equals(code) ) {
				return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,cpEnum.toString());
			}
		}
		return null;
	}

	public static String getRtdByReportCode(String code){
		for (CpEnum cpEnum : values()) {
			if (cpEnum.getReportCode().equals(code) ) {
				return code+".Rtd";
			}
		}
		return null;
	}


	public static String getAvgByReportCode(String code){
		for (CpEnum cpEnum : values()) {
			if (cpEnum.getReportCode().equalsIgnoreCase(code) ) {
				return code+".Avg";
			}
		}
		return null;
	}

	CpEnum(String code, String name,String reportCode) {
		this.code = code;
		this.name = name;
		this.reportCode =reportCode ;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	public String getReportCode() {
		return reportCode;
	}
}
